﻿using System;
using System.Windows.Input;
using Inovout.Gui.Wpf.ViewModels;
using System.Collections.Generic;
using Inovout.Business;
using System.Linq;

namespace Inovout.Gui.Wpf.Commands
{
    public class ViewModelCommandManager
    {
        public static event EventHandler<CommandExecutedEventArgs> CommandExecuted;
        private static Dictionary<DomainViewModelFunctionKey, ICommand> domainViewModelCommandDictionaries = new Dictionary<DomainViewModelFunctionKey, ICommand>();


        public void Bind(Type domainViewModelType, Type modelType)
        {
        }

        public void AddHandler(Type domainViewModelType, Type modelType, Delegate handler)
        {

        }
        public static ICommand RegisterCommand(DomainViewModel domainViewModel, Function function)
        {
            ICommand cmmand = new ViewModelCommand(domainViewModel, function);
            domainViewModelCommandDictionaries.Add(new DomainViewModelFunctionKey(domainViewModel, function)
               , cmmand);
            return cmmand;
        }
        public static ICommand GetCommand(DomainViewModel domainViewModel, Function function)
        {
            DomainViewModelFunctionKey viewModelFunction = new DomainViewModelFunctionKey(domainViewModel, function);
            return domainViewModelCommandDictionaries[viewModelFunction];
        }
    }

}
